<template>
	<rui-pages>
		<rui-header></rui-header>
		<rui-devices :list="devices_list"></rui-devices>

		<rui-layer ref="refLayer"></rui-layer>
	</rui-pages>
</template>

<script setup>
	import {
		ref
	} from "vue"

	import {
		onLoad,
		onShow
	} from "@dcloudio/uni-app"

	import {
		getMyDevices
	} from "@/common/api.js"

	import {
		userStore
	} from "@/store/index.js"

	import Bluetooth from "@/util/bluetooth.js"
	const bluetooth = new Bluetooth();


	let user = userStore();
	let refLayer = ref("")
	let scrollTop = ref(0)
	let devices_list = ref([])

	onLoad(opts => {
		bluetooth.initialization()
	})
	
	onShow(() => {
		if(user.isLogin) {
			getMyDevices().then(res => {
				devices_list.value = res.data;
			})
		}
	})
</script>

<style>

</style>